package com.heeb.djl.boot.controller;

import com.heeb.djl.boot.rtsp.RtspUtils;
import lombok.extern.slf4j.Slf4j;
import org.bytedeco.javacv.FFmpegFrameGrabber;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.LinkedList;
import java.util.List;

/**
 * @Author bjiang
 * @Description //TODO
 * @Date 2022/1/17 8:47
 * @Version 1.0
 */
@RestController
@RequestMapping("/rtsp")
@Slf4j
public class RtspController {

    @Autowired
    private Environment environment;
    /**
     * @Author bjiang
     * @Description //TODO input 为视频流检测
     * @Date 9:13 2022/1/17
     * @Version 1.0
     * @Param [input]System.setProperty("java.awt.headless", "false");
     * @return void
     */
    @RequestMapping("/detectionRtsp")
    public void detectionRtsp(String input){
        log.info("开始执行接口，input={}",input);
        try {
            String path=environment.getProperty("model.path");
            RtspUtils.showCanvasFrame(input,path);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
